﻿#include <utility>

int profit[10];
int weight[10];
int numberOfObjects;

int f(int i, int theCapacity)
{/// 返回f(i, theCapacity) 的值
  if (i == numberOfObjects)
  {
    return (theCapacity < weight[numberOfObjects] ? 0 : profit[numberOfObjects]);
  }
  if (theCapacity <weight[i])
  {
    return f(i + 1, theCapacity);
  }
  return std::max(f(i + 1, theCapacity), f(i + 1, theCapacity - weight[i]) + profit[i]);
}
